<!DOCTYPE html>
<html>
	<?
	include 'web/header.phtml';
	?>
	<body>

		<?
		include 'web/body.header.phtml';
		include 'web/body.menu.phtml';
		?>

		<div id="page">

			<?
			include 'web/body.banner.phtml';
			?>
			<?
			include 'view/listCategory.php';
			?>

			<div id="content">
				<div class="box" id="box3">
					<h2 class="title1">Product</h2>
					<div class="entry">

						<div style="clear: both; margin-bottom: 20px;"></div>
						<form name="search" action="index.php?view=product" method="post"  enctype="multipart/form-data" onsubmit="return ValidateForm();">
							<div class="ProductTable">
								<table>
									<input type=hidden name="ProductID" id="ProductID">
									<tr>
										<td>Name:</td><td>
										<input type="text" name="Name" size=20 maxlength=200>
										</td>
										<td> </td><td>
										<select name="PriceFrom">
											<option value="0">Price From</option>
											<option value="100">100</option>
											<option value="200">200</option>
											<option value="300">300</option>
											<option value="400">400</option>
											<option value="500">500</option>
										</select></td>
										<td> </td><td>
										<select name="PriceTo">
											<option value="0">Price To</option>
											<option value="100">100</option>
											<option value="200">200</option>
											<option value="300">300</option>
											<option value="400">400</option>
											<option value="500">500</option>
										</select>
										</td>
										<td>
										<input type="submit" value="Search" name="Submit"/>
										</td>
									</tr>
								</table>
							</div>
						</form>
						<p class="links">
							<?=$PageLink ?>
						</p>
						<ul class="list2">
							<?php

							$stt = "disabled=disabled";
							if ($_SESSION['username']) {
								$stt = "";
							}

							if (count($products) == 0) {
								echo "Ko co san pham";
							} else {

								foreach ($products as $product) {
								  
									echo '
                                <li>
                                    <div class="product">                                       
                                        <div class="product-img">
                                            <a href="index.php?view=product&ProductID=' . $product[ProductID] . '" ><img src=web/images/product/thumb/thumb_' . $product[ImageName] . '></a>
                                        </div>
                                        <div class="product-con">
                                             <h2>' . $product[Name] . '</h2>
                                             <p>Id: ' . $product[ProductID] . '</p>
                                             <p>Cat:   ' . $product[Category] . '</p>
                                             <p>Quantity:    ' . $product[Quantity] . '<p>
                                             <p>Price: ' . $product[Price] . '$</p>
                                             <input type=text style="width:22px;" value="1" id="' . $product[ProductID] . '"/>
                                            <button ' . $stt . ' onclick=addtocart(' . $product[ProductID] . ',' . $product[Quantity] . ')>Buy</button>
                                        </div>                                        
                                    </div>
                                </li>  ';
								}
							}
							?>
						</ul>
					</div>
				</div>
			</div>

		</div>

		<?
		include 'web/body.wrapper.phtml';
		?>
	</body>
</html>